﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SLSYJ.Core.DataInterfaces;
using SLSYJ.Core;
using NHibernate;
using ProjectBase.Data.NHibernate;
using NHibernate.Criterion;

namespace SLSYJ.Data
{
    public class CategoryDao : GenericDao<Category>, ICategoryDao
    {
        #region ICategoryDao Members

        public List<Category> LoadCategoryBy(string categoryName)
        {
            ICriteria criteria = Session.CreateCriteria(typeof(Category))
                .Add(Expression.Eq("Name", categoryName));

            return criteria.List<Category>() as List<Category>;
        }

        #endregion
    }
}